/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package phd.dupenois.changeidentifiers.algorithms.boundingbox;

import phd.dupenois.changeidentifiers.dotpatterns.Coordinate;
import phd.dupenois.changeidentifiers.dotpatterns.DotPattern;
import phd.dupenois.changeidentifiers.footprints.Footprint;
import phd.dupenois.changeidentifiers.footprints.algorithms.FootprintAlgorithm;

/**
 *
 * @author Max
 */
public class BoundingBox extends FootprintAlgorithm{
    public BoundingBox(){
        super();
    }

    public void initialise() {
    }


    public Footprint generateFootprint(DotPattern pattern) throws Exception{
        if(!pattern.isFinalised()) pattern.finalise();
        Coordinate bottomLeft = pattern.getList().getBoxBottomLeft();
        Coordinate topLeft = pattern.getList().getBoxTopLeft();
        Coordinate topRight = pattern.getList().getBoxTopRight();
        Coordinate bottomRight = pattern.getList().getBoxBottomRight();
        Footprint box = new Footprint();
        box.addLine(bottomLeft, topLeft);
        box.addLine(topLeft, topRight);
        box.addLine(topRight, bottomRight);
        box.addLine(bottomRight, bottomLeft);
        return box;
    }
}

